#pragma once
#include <string>
#include <msclr/marshal_cppstd.h>
using namespace System;
using namespace Runtime::InteropServices;
using namespace  msclr::interop;
using namespace  std;

public ref class MarshalHelper
{
public:
    // String conversion
    static string ToNative(System::String^ managedString)
    {
        return marshal_as<string>(managedString);
    }

    static String^ ToManaged(const string& nativeString)
    {
        return gcnew String(nativeString.c_str());
    }

    // Boolean conversion
    static bool ToNative(System::Boolean managedBool)
    {
        return managedBool;
    }

    static Boolean ToManaged(bool nativeBool)
    {
        return nativeBool;
    }

    // Integer conversion
    static int ToNative(System::Int32 managedInt)
    {
        return managedInt;
    }

    static Int32 ToManaged(int nativeInt)
    {
        return nativeInt;
    }

    // Double conversion
    static double ToNative(System::Double managedDouble)
    {
        return managedDouble;
    }

    static Double ToManaged(double nativeDouble)
    {
        return nativeDouble;
    }

    //// Custom type conversion
    //static NativePoint ConvertToNativePoint(ManagedPoint^ managedPoint)
    //{
    //    NativePoint nativePoint;
    //    nativePoint.X = managedPoint->X;
    //    nativePoint.Y = managedPoint->Y;
    //    nativePoint.Z = managedPoint->Z;
    //    return nativePoint;
    //}

    //static ManagedPoint^ ConvertToManagedPoint(const NativePoint& nativePoint)
    //{
    //    ManagedPoint^ managedPoint = gcnew ManagedPoint();
    //    managedPoint->X = nativePoint.X;
    //    managedPoint->Y = nativePoint.Y;
    //    managedPoint->Z = nativePoint.Z;
    //    return managedPoint;
    //}
};